CREATE TABLE [dbo].[DnnProduct_EventLog]
(
[LogGUID] [varchar] (36) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[LogTypeKey] [nvarchar] (35) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[LogConfigID] [int] NULL,
[LogUserID] [int] NULL,
[LogUserName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LogPortalID] [int] NULL,
[LogPortalName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LogCreateDate] [datetime] NOT NULL,
[LogServerName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[LogProperties] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[LogNotificationPending] [bit] NULL,
[LogEventID] [bigint] NOT NULL IDENTITY(1, 1)
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[DnnProduct_EventLog] ADD CONSTRAINT [PK_DnnProduct_EventLogMaster] PRIMARY KEY CLUSTERED  ([LogEventID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DnnProduct_EventLog] ON [dbo].[DnnProduct_EventLog] ([LogConfigID], [LogTypeKey], [LogCreateDate]) WITH (FILLFACTOR=85) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DnnProduct_EventLog_LogGUID] ON [dbo].[DnnProduct_EventLog] ([LogGUID]) WITH (FILLFACTOR=75) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DnnProduct_EventLog] WITH NOCHECK ADD CONSTRAINT [FK_DnnProduct_EventLog_DnnProduct_EventLogConfig] FOREIGN KEY ([LogConfigID]) REFERENCES [dbo].[DnnProduct_EventLogConfig] ([ID])
GO
ALTER TABLE [dbo].[DnnProduct_EventLog] ADD CONSTRAINT [FK_DnnProduct_EventLog_DnnProduct_EventLogTypes1] FOREIGN KEY ([LogTypeKey]) REFERENCES [dbo].[DnnProduct_EventLogTypes] ([LogTypeKey])
GO
